#ifndef __LOG_H
#define __LOG_H


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>


#define PRINGT_DEBUG 


#ifdef PRINGT_DEBUG

//#define LOG(format, argument...) printf("\033[1;37m[ %s ](line %d) -> "format"\r\n\033[0m", __FUNCTION__, __LINE__, ##argument )
//#define LOGERR(format, argument...) printf("\033[1;31m[ %s ](line %d) -> "format"\n\033[0m", __FUNCTION__, __LINE__, ##argument ) 
//#define LOGWARN(format, argument...) printf("\033[1;33m[ %s ](line %d) -> "format"\n\033[0m", __FUNCTION__, __LINE__, ##argument ) 

//#define log(format, argument...) printf(format,##argument)
#define logerr(format, argument...) printf("\033[1;31m[ %s ]  %s (line %d) -> "format"\r\n\033[0m", __FUNCTION__,  __FILE__ ,__LINE__, ##argument ) 
#define logwarn(format, argument...) printf("\033[1;33m[ %s ](line %d) -> "format"\r\n\033[0m", __FUNCTION__, __LINE__, ##argument ) 
//#define logdbg(format, argument...) printf("\033[1;34m[ %s ](line %d) -> "format"\033[0m", __FUNCTION__, __LINE__, ##argument )

#define logwhite(format, argument...)   printf(format,##argument)
#define loggreen(format, argument...)   printf("\033[1;32m"format"\r\n\033[0m", ##argument )
#define logyellow(format, argument...)  printf("\033[1;33m"format"\r\n\033[0m", ##argument )  
#define logred(format, argument...) 	printf("\033[1;31m"format"\r\n\033[0m",     ##argument ) 
#define logblue(format, argument...) 	printf("\033[1;34m"format"\r\n\033[0m", ##argument ) 

#define logn()      printf("\r\n")  

#define logshellyellow(format, argument...)       printf("\033[1;33m"format"\r\n\033[0m", ##argument )    





//#define lodwhite(buf,len)       for(uint32_t i=0;i<len;i++)logwhite("%d ",((uint8_t*)buf)[i]);logn();LogGiveMutex();}while(0)
//#define loxwhite(buf,len)       for(uint32_t i=0;i<len;i++)printf("%02x ",((uint8_t*)buf)[i]);printf("\r\n");LogGiveMutex();}while(0)
//#define loxgreen(buf,len)       for(uint32_t i=0;i<len;i++)printf("%02x ",((uint8_t*)buf)[i]);printf("\r\n");LogGiveMutex();}while(0)
//#define loxyellow(buf,len)      for(uint32_t i=0;i<len;i++)logyellow("%02x ",buf[i]);logn();LogGiveMutex();}while(0)
//#define loxred(buf,len)         for(uint32_t i=0;i<len;i++)logred("%02x ",buf[i]);logn();LogGiveMutex();}while(0)
//#define loxblue(buf,len)        for(uint32_t i=0;i<len;i++)logblue("%02x ",buf[i]);logn();LogGiveMutex();}while(0)
//#define loxwhite10(buf,len)     for(uint32_t i=0;i<len;i++)printf("%d ",((uint8_t*)buf)[i]);printf("\r\n");LogGiveMutex();}while(0)

//#define probe() printf("\033[1;31m[%s] %s:%d -> probe();\n\033[0m", __FUNCTION__, __FILE__,__LINE__) 
/*time logout*/
//#define tlogblue(format, argument...) printf("\033[1;34m"format"\033[0m",##argument ) 

#define log_which_fun(format, argument...)       printf("\033[1;37m[ %s ]"format"\r\n\033[0m", __FUNCTION__, ##argument ) 

//#define logcwhite(buf,len)     for(uint32_t i=0;i<len;i++) printf("%c",((char*)buf)[i]);printf("\r\n");LogGiveMutex();}while(0)



#else


#define LOG(format, argument...) 
#define LOGERR(format, argument...) 
#define LOGWARN(format, argument...) 

#define log(format, argument...) 
#define logerr(format, argument...)
#define logwarn(format, argument...) 
#define logdbg(format, argument...) 

#define logwhite(format, argument...) 
#define loggreen(format, argument...) 
#define logyellow(format, argument...)  
#define logred(format, argument...) 
#define logblue(format, argument...) 

#define logn() 

#define loxwhite(buf,len) 
#define loxgreen(buf,len) 
#define loxyellow(buf,len) 
#define loxred(buf,len) 
#define loxblue(buf,len) 
	
#define probe() 
/*time logout*/
#define tlogblue(format, argument...) 
#define log_which_fun(format, argument...)

#define logcwhite(buf,len)




#endif



#define PRINGT_TEST

#ifdef  PRINGT_TEST

#define logbluetest(format, argument...) 	     printf("\033[1;34m"format"\r\n\033[0m", ##argument ) 
#define loxwhitetest(buf,len)       for(uint32_t i=0;i<len;i++)printf("%02x ",((uint8_t*)buf)[i]);printf("\r\n");LogGiveMutex();}while(0)
#endif



#endif

